﻿using log4net;
using Service.Net.Model;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Authentication;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;

namespace SignalRClientTool.Models
{
    public class ClientToolManager : IClientToolManager
    {
        private const string _configFile = @"Conf/NetOptions.json";

        private ConnectModel connectModel;

        public ConnectModel GetNetConfig()
        {
            connectModel = JsonHelper.DeserializeFromFile<ConnectModel>(_configFile);
            return connectModel;
        }

        public Dictionary<string, object> GetNetConfigToDictionary()
        {
            var tempInfo = JsonHelper.DeserializeFromFile<Dictionary<string, object>>(_configFile);
            return tempInfo;
        }

        public Task SaveMqttConfig(object data)
        {
            return JsonHelper.SerializeToFile(data, _configFile);
        }
    }
}
